<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Unit Test: Dynamic Stylesheet</title>
    <script type="text/javascript" src="../scripts/dd/dd.js"></script>
    <script type="text/javascript">
    dd({
        modules:[
            "http",
            "dss"
        ]
    }).event({
        load:function()
        {
            dd.dss.createLayer("global");
            dd.dss.createLayer("page");
            dd.dss.addStyle("body > div", "background:yellow;", "global");
            dd.dss({
                url:"ex1.dss",
                layer:"page",
                success:function()
                {
                    //alert("Loaded " + this.lines + " lines.");
                },
                failure:function()
                {
                    alert("Error(" + this.errorCode + "): " +  this.error);
                }
            });
            var btn = dd(dd.body).addElement("a", "Switch", {href:""});
            dd(btn).event({
                click:function()
                {
                    dd.dss.clear("page");
                    dd.dss({
                        url:"ex2.dss",
                        layer:"page",
                        success:function()
                        {
                            //alert("Loaded " + this.lines + " lines.");
                        },
                        failure:function()
                        {
                            alert("Error(" + this.errorCode + "): " +  this.error);
                        }
                    });
                }
            });
            var btn2 = dd(dd.body).addElement("a", "Switch Two", {href:""});
            dd(btn2).event({
                click:function()
                {
                    dd.dss.clear("page");
                    dd.dss({
                        url:"ex1.dss",
                        layer:"page",
                        success:function()
                        {
                            //alert("Loaded " + this.lines + " lines.");
                        },
                        failure:function()
                        {
                            alert("Error(" + this.errorCode + "): " +  this.error);
                        }
                    });
                }
            });
        }
    });
    </script>
</head>
<body>
    <div class="class-name">
        <p>Blue</p>
        <div class="class-name">Red</div>
        <small class="green">green</small>
    </div>
</body>
</html>
